<?php

namespace App\Observers;

use App\Program;
use Illuminate\Http\Request;

class ProgramObserver
{
    /**
     * 监听用户修改的事件。
     *
     * @param  Program  $program
     * @return void
     */
    public function updated(Program $program)
    {
    //file\201812\058f26b59c8e66c607e29f8228319eec.zip
        $file = $program->toArray();
        if (isset($file['Program_file'])) {
             return;
        } else {
            $newProgram = Program::find($file['id']);
            $newProgram->program_file = $file["program_file"];
            $newProgram->save();
        }
    }
}
